<template>
  <div>

    <div class="scalable-pages">

      <headers @givedata="givedata"></headers>
      <div class="swipers" v-if="navs == 2">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/news.jpg" />
        <!-- 自定义指示器 -->
        <div class="custom-indicator">
          <div v-for="(slide, index) in slides" :key="index" class="indicator-dot"
            :class="{ active: currentSlide === index }" @click="goToSlide(index)"></div>
        </div>
      </div>
      <div v-show="urls == '/windowmembrane' && navs == 0">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/qichemo.png" />
        <windowmembrane></windowmembrane>
      </div>
      <div v-show="urls == '/paintprotection' && navs == 0">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/jiaju.png" />
        <paintprotection></paintprotection>
      </div>
      <div v-show="urls == '/construction' && navs == 0">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/jiaju.png" />
        <construction></construction>
      </div>
      <div v-show="navs == 1">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/store.jpg" />
        <store></store>
      </div>
      <div v-show="navs == 2">
        <indexs></indexs>
      </div>
      <div v-show="urls == '/aboutus' && navs == 3">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/about.jpg" />
        <aboutus></aboutus>
      </div>
      <div v-show="urls == '/news' && navs == 3">
        <img class="banners" src="https://www.kdxwindowfilm.com/banners/news.jpg" />
        <news></news>
      </div>

      <bottoms></bottoms>
    </div>
  </div>
</template>
 
<script>
import indexs from "../index/index.vue"
// 汽车窗膜
import windowmembrane from "../windowmembrane/index.vue"
import aboutus from "../aboutus/index.vue"
import news from "../news/index.vue"
import store from "../store/index.vue"
import construction from "../construction/index.vue"
import paintprotection from "../paintprotection/index.vue"
import headers from "/components/headers.vue"
import bottoms from "/components/bottoms.vue"
// 导入 Swiper Vue 组件和样式文件
import { Swiper, SwiperSlide } from 'swiper/vue';
import 'swiper/swiper-bundle.css';

export default {
  components: {
    construction,
    paintprotection,
    store,
    windowmembrane,
    aboutus,
    news,
    indexs,
    Swiper,
    SwiperSlide,
    headers,
    bottoms,

  },
  data() {
    return {
      navs: 0,
      currentSlide: 0,
      slides: 3, // 根据实际幻灯片数量设置
      urls: "/windowmembrane",
      swiperOptions: {
        slidesPerView: 3,
        spaceBetween: 30,
        loop: true,
        // 禁用默认分页
        pagination: false
      }
    };
  },
  mounted() {
  },
  methods: {
    updateIndicator() {
      const swiper = this.$refs.mySwiper.$swiper;
      this.currentSlide = swiper.realIndex;
    },
    goToSlide(index) {
      const swiper = this.$refs.mySwiper.$swiper;
      swiper.slideTo(index);
    },
    givedata(item) {
      console.log(item)
      let indexs = item.nav
      let url = item.url
      this.urls = url
      if (indexs == 0) {
        if (url == '/windowmembrane') {
          //汽车窗膜
        }
      }
      this.navs = indexs
    },
  },
}
</script>
<style scoped>
.banners {
  width: 100%;
  display: block;
}

.custom-indicator {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  position: absolute;
  bottom: 50px;
  z-index: 99;
  left: 50%;
  transform: translateX(-50%);
}

.indicator-dot {
  width: 25px;
  height: 5px;
  margin: 0 8px;
  border-radius: 5px;
  background-color: rgb(106, 107, 106);
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator-dot.active {
  background-color: #ffffff;
  /* 你的主题色 */
  transform: scale(1.3);
  width: 40px;
}

.indicator-dot:hover {
  background-color: #ffffff;
  /* 悬停颜色 */
}


.biaoshi {
  width: 64px;
  display: block;
  height: 74px;
}



.more {
  color: rgb(197, 0, 10);
  font-size: 23px;
  text-align: right;
}

.xonnei {
  font-size: 23px;
  line-height: 47px;
  text-align: left;
  color: rgb(46, 46, 46);
}

.newti {
  text-align: left;
  font-size: 30px;
}


.biaoti {
  width: 100%;
}


.news {
  background: rgb(245, 245, 245);
  width: 100%;
  padding: 50px;
  box-sizing: border-box;
}

.titless {
  text-align: center;
  font-size: 40px;
  line-height: 120px;
  position: relative;
}

.titless::before {
  position: absolute;
  content: "";
  width: 80px;
  height: 10px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: rgb(197, 0, 10);
}

.liaojie {
  float: right;
}

.lis {
  font-size: 30px;
  padding: 15px;
  position: relative;
}

.lis::before {
  content: "";
  width: 10px;
  height: 10px;
  background: rgb(197, 0, 10);
  position: absolute;
  left: -10px;
  top: 35px;
  border-radius: 50%;
}

.video {
  width: 100%;
  background: black;
}

.btn2 {
  position: absolute;
  bottom: 45%;
  right: 300px;
}

.centerb {
  position: relative;
}

.centerimg {
  width: 100%;
}

.anniu {
  background: rgb(197, 0, 10);
  color: white;
  text-align: center;
  margin-top: 50px;
  border-radius: 6px;

  width: 168px;
  line-height: 50px;
  font-size: 24px;
}

.tit2 {
  font-size: 24px;
  color: rgb(56, 56, 56);
  line-height: 50px;
  margin-top: 80px;
  text-align: justify;
}

.lines {
  display: flex;
  justify-content: center;
  justify-items: center;
  height: 749px;
  padding: 90px 0;
}

.tupian {
  flex: 1;
  height: 749px;
  background-size: cover;
  background-position: center;
}

.text {
  color: rgb(8, 8, 8);
}

.word1 {
  font-size: 40px;
  color: rgb(197, 0, 10);
  font-weight: bold;
  overflow: hidden;
}

.wordbox {
  overflow: hidden;
  flex: 1;
}

.title {
  line-height: 148px;
  position: relative;

}

.title::before {
  content: "";
  position: absolute;
  width: 96px;
  height: 11px;
  background: rgb(197, 0, 10);
  bottom: 0px;
  border-radius: 5px;
}

.words {
  width: 80%;
  float: right;
  padding-right: 20px;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

.lines {
  overflow: hidden;
  height: 749px;
}

.lines:nth-child(odd) .wordbox {
  float: left;
}

.lines:nth-child(odd) .wordbox .words {
  float: right;
}

.lines:nth-child(even) .wordbox .words {
  float: left;
  padding-left: 30px;
}

.lines:nth-child(even) {
  background: rgb(245, 245, 245);
}

.lines:nth-child(even) .tupian {
  float: right;
}

.neirong2 {
  overflow: hidden;
}

.banners {
  width: 100%;

  display: black
}

.swipers {
  width: 100%;
  /* height: 500px; */
}
</style>